package com.mrdeer.iot.bean;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mrdeer.common.valid.Read;
import com.mrdeer.common.valid.Write;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @Author: xie jianchu
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CmdParameter {
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "device id can't be empty", groups = {Read.class, Write.class})
    private String deviceId;

    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "point id can't be empty", groups = {Read.class, Write.class})
    private String pointId;

    @NotBlank(message = "value can't be empty", groups = {Write.class})
    private String value;
}
